from tkinter import *

from tkinter.messagebox import showinfo

import tkinter

def reply():

    showinfo(title='欢迎来到弹弹弹的世界（*ﾟ∀ﾟ）つ', message='你想要进去吗ฅ(*°ω°*ฅ)*')
    showinfo(title="警告",message="前方高能")
    showinfo(title="警告",message="这是一个没有退路的游戏")
    import pygame as pg
    import sys
    import random
    import time

    pg.init()
    game_window = pg.display.set_mode((600, 500))
    pg.display.set_caption('接球游戏')
    window_color = (111, 200, 255)
    ball_color = (255, 165, 10)
    rect_color = (255, 111, 100)
    score = 0
    font = pg.font.Font(None, 70)
    ball_x = random.randint(20, 580)
    ball_y = 20
    move_x = 1
    move_y = 1
    point = 1
    count = 0
    while True:
        game_window.fill(window_color)
        for event in pg.event.get():
            if event.type == pg.QUIT:
                sys.exit()
        mouse_x, mouse_y = pg.mouse.get_pos()
        pg.draw.circle(game_window, ball_color, (ball_x, ball_y), 20)
        pg.draw.rect(game_window, rect_color, (mouse_x, 490, 100, 10))
        my_text = font.render(str(score), False, (255, 255, 255))
        game_window.blit(my_text, (500, 30))
        ball_x += move_x
        ball_y += move_y
        if ball_x <= 20 or ball_x >= 580:
            move_x = -move_x
        if ball_y <= 20:
            move_y = -move_y
        elif mouse_x - 20 < ball_x < mouse_x + 120 and ball_y >= 470:
            move_y = -move_y
            score += point
            count += 1
            if count == 3:
                count = 0
                point += point
                if move_x > 0:
                    move_x += 1
                else:
                    move_x -= 1
                move_y -= 1
        elif ball_y >= 480 and (ball_x <= mouse_x - 20 or ball_x >= mouse_x + 120):
            break
        pg.display.update()
        time.sleep(0.005)
    pg.quit()
    showinfo(title='神秘的窗口', message='这是一次不得不接受的复活机会')
    import pygame as pg
    import sys
    import random
    import time

    pg.init()
    game_window = pg.display.set_mode((600, 500))
    pg.display.set_caption('接球游戏')
    window_color = (111, 200, 255)
    ball_color = (255, 165, 10)
    rect_color = (255, 111, 100)
    score = 0
    font = pg.font.Font(None, 70)
    ball_x = random.randint(20, 580)
    ball_y = 20
    move_x = 1
    move_y = 1
    point = 1
    count = 0
    while True:
        game_window.fill(window_color)
        for event in pg.event.get():
            if event.type == pg.QUIT:
                sys.exit()
        mouse_x, mouse_y = pg.mouse.get_pos()
        pg.draw.circle(game_window, ball_color, (ball_x, ball_y), 20)
        pg.draw.rect(game_window, rect_color, (mouse_x, 490, 100, 10))
        my_text = font.render(str(score), False, (255, 255, 255))
        game_window.blit(my_text, (500, 30))
        ball_x += move_x
        ball_y += move_y
        if ball_x <= 20 or ball_x >= 580:
            move_x = -move_x
        if ball_y <= 20:
            move_y = -move_y
        elif mouse_x - 20 < ball_x < mouse_x + 120 and ball_y >= 470:
            move_y = -move_y
            score += point
            count += 1
            if count == 3:
                count = 0
                point += point
                if move_x > 0:
                    move_x += 1
                else:
                    move_x -= 1
                move_y -= 1
        elif ball_y >= 480 and (ball_x <= mouse_x - 20 or ball_x >= mouse_x + 120):
            break
        pg.display.update()
        time.sleep(0.005)
    pg.quit
    showinfo(title='开发人员办公室', message='GAMEOVER')


def reply1():
    showinfo(title="关于",message="游戏规则：\n在界面上移动鼠标控制板的移动来接小球，\n接住一次则得1分，漏掉则游戏结束")

windows = Tk()
windows.title("game")
windows.geometry("600x400")
windows['bg'] = '#D8BFD8'
label=tkinter.Label(windows,text="18060211\n18060211124 18060211125 18060211126\n曹先丽   焦雨欣   荆甜甜",font=("正楷",24),fg="yellow", bg="Thistle")  #背景颜色
label.pack()

button=Button(windows, text='开始游戏', command=reply)

button.pack()

button .place(x=200,y=200)

button=Button(windows,text="关于游戏",command=reply1)

button.pack()

button.place(x=300,y=200)

windows.mainloop()

